package com.camel.base.service;

import com.camel.base.model.ZsAnswer;
import com.camel.base.model.ZsSurvey;
import com.camel.base.model.tem.AnswerSubmit;
import com.camel.core.entity.BasePaginationEntity;
import com.camel.core.service.BaseCommonService;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

import java.util.List;

/**
 * @author camel
 */
public interface ZsSurveyService<T extends BasePaginationEntity> extends BaseCommonService<T> {

    XSSFWorkbook getImportTemplate(Integer id);

    /**
     * 提交答案
     * 不報錯就成功
     *
     * @param submit
     */
    void aswer(List<AnswerSubmit> submit);

    /**
     * 查询问卷总配额是否已经打满
     *
     * @param survey
     * @return
     */
    boolean isFull(ZsSurvey survey);

    /**
     * 查询问卷是否已经作答
     *
     * @param surveyId
     * @param lable
     * @param phone
     * @return
     */
    boolean isAnsweed(Integer surveyId, String phone, String lable);

    /**
     * 有效的答案数量
     *
     * @param surveyId
     * @return
     */
    int validAnswerNum(Integer surveyId);

    /**
     * 保存一个样本 （非明细）
     *
     * @param submits
     * @return
     */
    ZsAnswer addNewAnswer(List<AnswerSubmit> submits);

    /**
     * 保存前的验证
     * @param entity
     * @return
     */
    boolean validSave(ZsSurvey entity);
}
